<%@ page import="java.util.*" %>
<%@ page import="util.*" %>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Sistema CDs</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <h1>Sistema CDs</h1>
  <h2>Detalle de Track</h2>
  <% TrackDTO track = (TrackDTO)request.getAttribute("track"); %>
  <% List CDs = (List)request.getAttribute("CDs"); %>
  
  <form name="ActualizarTrack" action="/actualizarTrack" method="get">
    <input type="hidden" name="pk_track" value="<%= track.getPk_track() %>"/>    
    <table>
      <thead>
        <tr>
          <th></th><th></th>
        </tr>
      </thead>
      <tbody>
        <tr>          
          <td>Nombre:</td><td><input type="text" name="nombre" value="<%= track.getNombre() %>"/></td>
        </tr>
        <tr>
          <td>Autor:</td><td><input type="text" name="autor" value="<%= track.getAutor() %>"/></td>
        </tr>
        <tr>
          <td>Duracion</td>
          <td>
            <input type="text" name="duracion" value="<%= track.getDuracion() %>"/>
          </td>
        </tr>
        <tr>
          <td>CD:</td>
          <td>
            <select name="fk_CD">
              <% for(int i = 0, n = CDs.size(); i < n; i++) {
                      CDDTO CD= (CDDTO) CDs.get(i); %>
                      <option value="<%= CD.getPk_CD() %>" 
                        <% if(CD.getPk_CD()==track.getFk_CD()){ %> selected <% } %> >
                        <%= CD.getNombre() %>
                      </option>
              <% } %>
            </select>
          </td>
        </tr>      
      </tbody>
      <tfoot>
        <tr>
          <td><input type="submit" value="Actualizar" /></td><td></td>
        </tr>
      </tfoot>
    </table>
  </form>
</html>